package com.neo.springcloud.alibaba.controller;

import com.neo.springcloud.alibaba.domain.CommonResult;
import com.neo.springcloud.alibaba.service.StorageService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @ClassName: StorageController
 * @Title: cloud2021
 * @Package: com.neo.springcloud.alibaba.controller
 * @Description:
 * @Author: Kisen
 * @Date: 2021/11/25 22:23
 */
@RestController
public class StorageController {

    @Resource
    private StorageService storageService;

    /**
     * 扣减库存
     *
     * @param productId
     * @param count
     * @return
     */
    @RequestMapping("/storage/decrease")
    public CommonResult decrease(Long productId, Integer count) {
        storageService.decrease(productId, count);
        return new CommonResult(200, "扣减库存成功！");
    }
}
